Skip to content

Minor bug fixes and docs improvements #873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 22, 2022
Merged

Conversation

gabrieljablonski
Copy link
Member

@gabrieljablonski gabrieljablonski commented Dec 21, 2022

Closes #872
Closes #875

After agreeing on these the PR should be ready to review.

State/Uncontrolled tooltip state section

Should we remove this section? It just shows a limitation of the component (which could be fixed, but why?), and the use case in the example can be much more conveniently achieved by using the recently added provider.

Click event

Since the recent design change (when clicking an open tooltip with click event enabled, it no longer closes the tooltip), does it even make sense to use both hover and click event simultaneously? Maybe we should remove the last section.


Further considerations (slightly related to PR)

I propose a breaking API change (maybe initially just deprecate events instead of fully removing it) similar to how V4s effect: 'solid' | 'float' prop got replaced by just the float: boolean prop.

A click: boolean prop would replace the events prop to activate the "on click" mode.

Copy link
Member Author

@gabrieljablonski gabrieljablonski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Since data-tooltip-content was never intended to render html stuff, removed it from relevant sections.

  • The "Content" example page is redundant, since it became exactly the "Basic examples" page.

@danielbarion
Copy link
Member

  • Since data-tooltip-content was never intended to render html stuff, removed it from relevant sections.
  • The "Content" example page is redundant, since it became exactly the "Basic examples" page.

I wrote the content example page because of the prop, not because of the feature (the content can be tracked in algolia search engine, so, if someone wants know about this specific prop, this will be possible because of this page)

@danielbarion
Copy link
Member

Everything else, I totally agree

if (html) {
// html will take precedence
setIsHtmlContent(true)
setTooltipContent(html)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the feeling that we will spend resources (a bit) doing the:

setIsHtmlContent(false)

and after that:

setIsHtmlContent(true)

In this case, I prefer not to do the setIsHtmlContent(false) if we will do setIsHtmlContent(true) two lines below.

Is this necessary in this order? or can we add a validation to do one or other?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation would only serve to make the code clearer (which I think is unnecessary, since it's simple enough).

React 18 batches useState() updates, so the state is effectively only updated once. This source is a bit outdated, but I'm pretty sure that still holds true.

We can come back to this in the future if we ever decide to improve the content/html props (maybe there shouldn't be a single state variable - tooltipContent - that holds the value for the one being actually used).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, interesting!

ok

@gabrieljablonski gabrieljablonski marked this pull request as ready for review December 22, 2022 14:58
@gabrieljablonski gabrieljablonski merged commit 1b7c5a4 into master Dec 22, 2022
@gabrieljablonski gabrieljablonski deleted the minor-bug-fixes branch December 22, 2022 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Changing the content prop to a falsey value doesn't update the displayed content [BUG] Tooltips as react children element don't show anything
2 participants